const express = require('express')

const router = require('./router')

const app = express()

//设置跨域头
app.use(function (request, response, next) {
  response.header("Access-Control-Allow-Origin", "*");
  response.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
  next();
});

//配置post请求
app.use(express.urlencoded({
  extended: false
}))
app.use(express.json())


app.use(router)

app.listen(8000, () => {
  console.log('8000端口已开启');
})